<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>1、找重复把一个数组(arr1)里重复的数放到另一个数组(arr2)里，并打印 arr2。 </title>
</head>

<body>
  <script>
    let arr = [1, 1, 2, 2, 3, 3, 78, 45, 8, 8]
    var sum = [];
    for (var i = 0; i < arr.length - 1; i++) {
      if (arr[i] == arr[i + 1]) {
        sum.push(arr[i])
      }
    }
    console.log(sum)
  </script>
</body>

</html>